package com.charlie.meetingmanagement.Filter;

import jakarta.servlet.*;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Component;

import java.io.IOException;


//@Component//暂时好像还没有发挥作用
public class CharacterEncodingFilter {
//    public class CharacterEncodingFilter implements Filter {
//    @Override
//    public void init(FilterConfig filterConfig) throws ServletException {
//        Filter.super.init(filterConfig);
//    }
//
//    @Override
//    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
//            throws IOException, ServletException {
//        // 设置请求和响应的字符编码
//        request.setCharacterEncoding("UTF-8");
//        response.setCharacterEncoding("UTF-8");
//
//        // 设置响应内容类型
//        if (response instanceof HttpServletResponse) {
//            ((HttpServletResponse) response).setContentType("application/json;charset=UTF-8");
//        }
//
//        chain.doFilter(request, response);
//    }
//
//    @Override
//    public void destroy() {
//        Filter.super.destroy();
//    }

}
